package com.cet.designpatterns.memento;

/**
 * 描述：发起人
 * @author chenentao
 * @date 2021/9/24 10:00
 */
class Originator {

    private String name;

    private String state;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getState() {
        return state;
    }

    public Memento saveStateMemento() {
        return new Memento(state);
    }

    public void restoreState(Memento m) {
        this.setState(m.getState());
    }

    @Override
    public String toString() {
        return "Originator{" +
                "name='" + name + '\'' +
                ", state='" + state + '\'' +
                '}';
    }
}
